Many databases log changes to records in redo logs and undo logs. The redo log protects the database from the loss of integrity because of system failures caused by power outages, disk failures, and the like. If such an event occurs, the recovery process can be applied to all transactions, both uncommitted as well as committed, to the data-files on disk, using the information in the redo log.
All log transactions that have been committed are redone while all open transactions that have not been committed are undone using the undo log. The undo records in the undo log can be used to rollback transactions, for example, when a rollback statement is issued. When a rollback statement is issued, undo records are used to undo changes that was made to the database by any uncommitted transactions. During recovery, undo records are used to undo any uncommitted changes applied from the redo log to the records. Undo records provide read consistency by maintaining the before image of the data for users who are accessing the data at the same time that another user is changing it.